package ru.ipccenter.managedBeans;


import java.io.Serializable;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ivan
 */
@SessionScoped
@ManagedBean(name = "index")
public class IndexManagedBean implements Serializable {
    
    private static final Logger LOG = Logger.getLogger(IndexManagedBean.class.getCanonicalName());
    
    private static final String allAutorsPage = "authors";
    private static final String helloPage = "hello";
    private static final String facesExt = ".xhtml";

    private String curentPage = getHelloPage();

    public String getCurentPage() {
        LOG.info("getCurentPage:" + curentPage);
        return curentPage;
    }
    
    public void showHelloPage(ActionEvent ae) {
        curentPage = getHelloPage();
        LOG.info("showHelloPage:" + curentPage);
    }
    
    public void showAutorsPage(ActionEvent ae) {
        curentPage = getAllAutorsPage();
        LOG.info("showAutorsPage:" + curentPage);
    }
    
    public String getAllAutorsPage() {
        return allAutorsPage + facesExt;
    }
    
    public String getHelloPage() {
        return helloPage + facesExt;
    }
}
